package pack0621;

import java.util.Scanner;

public class DemoB {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        System.out.println("请输入第一个数");
        int a =scan.nextInt();
        System.out.println("请输入第二个数");
        int b = scan.nextInt();

        int i=0;
        int j=0;
        if (a>b) {
            i = a;
            j = b;
        }else{
            i=b;
            j=a;

        }
        int gongyueshu = 0;
        for (int c=1;c<=j;c++){
            if (i % c==0 && j % c==0);
                gongyueshu=c;
        }
        System.out.println("最大公约数"+gongyueshu);

        for (int d=1; ;d++) {
            if (d % i == 0 || d % j == 0) {
                System.out.println("最小公倍数" + d);
                break;
            }
        }
    }
}
